import java.util.*;

public class MainMoney {
    public final static int INF=Integer.MAX_VALUE;
    public void mainMoney(){
        FloydInGraph graph=new FloydInGraph(10);
        int[][] matrix={
                {INF,960,500,INF,INF,INF,INF,INF,INF,INF},
                {960,INF,1500,1000,INF,INF,INF,INF,INF,INF},
                {500,1500,INF,1280,INF,INF,INF,INF,INF,INF},
                { INF,1000,1280,INF,900,INF,INF,INF,INF,INF},
                {INF,INF,INF,INF,INF,1010,INF,INF,INF,INF},
                {INF,INF,INF,INF,1010,INF,	800,INF,INF,INF},
                {INF,INF,INF,INF,INF,INF,INF	,1060,INF,INF},
                {INF,INF,INF,INF,INF,INF,1060,INF,700,INF},
                {INF,INF,INF,INF,INF,INF,INF,INF,INF,1250},
                {INF,INF,INF,INF,INF,INF,INF,INF,1250,INF},
        };
        Main m = new Main();
        System.out.println("————————————————————————————————————————————");
        System.out.println("请输入要查找的起始点和终止点：");
        Scanner sc=new Scanner(System.in);
        int begin = 0,end = 0;
        switch (sc.next()) {
            case "合肥":
                begin = 0;
                break;
            case "北京":
                begin = 1;
                break;
            case "上海":
                begin = 2;
                break;
            case "重庆":
                begin = 3;
                break;
            case "广州":
                begin = 4;
                break;
            case "南京":
                begin = 5;
                break;
            case "深圳":
                begin = 6;
                break;
            case "桂林":
                begin = 7;
                break;
            case "昆明":
                begin = 8;
                break;
            case "西安":
                begin = 9;
                break;
            default:
                System.out.println("请输入合肥、北京、上海、重庆、广州、南京、深圳、桂林、昆明、西安中的两座城市。");
                break;
        }
        switch (sc.next()) {
            case "合肥":
                end = 0;
                break;
            case "北京":
                end = 1;
                break;
            case "上海":
                end = 2;
                break;
            case "重庆":
                end = 3;
                break;
            case "广州":
                end = 4;
                break;
            case "南京":
                end = 5;
                break;
            case "深圳":
                end = 6;
                break;
            case "桂林":
                end = 7;
                break;
            case "昆明":
                end = 8;
                break;
            case "西安":
                end = 9;
                break;
            default:
                System.out.println("请输入合肥、北京、上海、重庆、广州、南京、深圳、桂林、昆明、西安中的两座城市。");
                break;
        }
        graph.findCheapestPath(begin,end,matrix);
        List<Integer> list=graph.result;
        System.out.print(String.valueOf(begin).replace("0","合肥").replace("1","北京")
                .replace("2","上海").replace("3","重庆").replace("4","广州")
                .replace("5","南京").replace("6","深圳").replace("7","桂林")
                .replace("8","昆明").replace("9","西安")
                +" 到 "+String.valueOf(end).replace("0","合肥").replace("1","北京")
                .replace("2","上海").replace("3","重庆").replace("4","广州")
                .replace("5","南京").replace("6","深圳").replace("7","桂林")
                .replace("8","昆明").replace("9","西安")+",最低票价为:");
        System.out.println(graph.dist[begin][end]+"元");
        System.out.println(list.toString().replace("0","合肥").replace("1","北京")
                .replace("2","上海").replace("3","重庆").replace("4","广州")
                .replace("5","南京").replace("6","深圳").replace("7","桂林")
                .replace("8","昆明").replace("9","西安"));
        System.out.println("————————————————————————————————————————————");
        System.out.println("（1）返回\t\t（2）退出");
        int j = sc.nextInt();
        switch (j) {
            case 1:
                m.menu();
            case 2:
                break;
            default:
                System.out.println("请输入1、2进行选择。");
                break;
        }
    }
}
